package top.hjcwzx.wrench.mqtt.strategy.impl;

import top.hjcwzx.wrench.mqtt.strategy.MqttMessageHandler;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;


public class DirectCallbackStrategy implements MqttMessageHandler {

    @Override
    public void handleMessage(String topic, String payload, Map<String, List<Consumer<Object>>> topicHandlerMap) {
        topicHandlerMap.getOrDefault(topic, Collections.emptyList())
                .forEach(handler -> handler.accept(payload));
        // 不发布事件
    }
}
